    package parse_excel;
    use strict;
    use Spreadsheet::ParseExcel;
    use Encode;

sub parse_excel {
    my $file = shift;
    my $ibook = Spreadsheet::ParseExcel::Workbook->Parse($file) or die "$! - $file\n";
    my $obook = [];
    my $nbook = [];
    foreach my $isheet (@{$ibook->{Worksheet}}) {
        my $name = $isheet->{Name};
        my $minrow = $isheet->{MinRow};
        my $maxrow = $isheet->{MaxRow} || $minrow;
        my $mincol = $isheet->{MinCol};
        my $maxcol = $isheet->{MaxCol} || $mincol;
        my $osheet = [];
        foreach my $row ( $minrow .. $maxrow ) {
            my $oline = [];
            foreach my $col ( $mincol .. $maxcol ) {
                my $cell = $isheet->{Cells}[$row][$col] or next;
                my $val = $cell->{Val};
                next unless defined $val;
                next if ( $val eq "" );
                if ( $cell->{Code} eq 'ucs2' ) {
                    $val = decode( UCS2 => $val );
                } elsif ( $cell->{Code} eq '_native_' ) {
                    $val = decode( CP932 => $val );
                }
                $oline->[$col] = $val;
            }
            next unless scalar @$oline;
            push( @$osheet, $oline );
        }
        push( @$obook, $osheet );
        push( @$nbook, $name );
    }
    wantarray ? ($obook, $nbook) : $obook;
}

;1;

